import { useAxios } from '@/hooks/web/useAxios'
import type { TableData } from './types'
const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 订单列表
export const adminCsOrderListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsOrderList',
      data: data
    }
  })
}

// 查看
export const adminCsOrderSeeApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsOrderSee',
      data: data
    }
  })
}

// 订单修改
export const adminCsOrderEditApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsOrderEdit',
      data: data
    }
  })
}

// 订单新增
export const adminCsOrderAddApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsOrderAdd',
      data: data
    }
  })
}

// 订单删除
export const adminCsOrderDelApi = (data: TableData) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsOrderDel',
      data: data
    }
  })
}

// 订单批量删除
export const adminCsOrderBatchDelApi = (data: { ids: string }) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'adminCsOrderBatchDel',
      data: data
    }
  })
}
